<template>
  <div>
    <p>子组件数据：{{ count }}</p>
    <button @click="add">加1</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      count: 0,
    };
  },
  methods: {
    add() {
      this.count += 1;
      this.$emit("countChange", this.count);
    },
  },
};
</script>
